module.exports = ({ types }) => {
  let testPathNode = null;
  return {
    visitor: {
      MemberExpression(path) {
        // console.log('MemberExpression>>>>', path.node);
        const { type, object, property } = path.node;
        if (testPathNode && type === 'MemberExpression' && object.name === 'appInfo' && property.name === 'url') {
          path.parentPath.replaceWith(
            types.expressionStatement(testPathNode)
          );
        }
      },
      Identifier(path) {
        if (path.node.name === 'testPath') {
          testPathNode = path.node;
        }
      },
    }
  }
}
